home *** CD-ROM | disk | FTP | other *** search
/ Micromanía 92 / CDMM92_1.ISO / SOF 2 SDK / sof2sdk-101.msi / _92D6AC311BB48EBA344BBABC89DA6AB0 / _6C89DF6A5E7F4B53807475C7F312F0D7 < prev    next >
Encoding:
Text File  |  2002-04-06  |  9.6 KB  |  364 lines

  1. #define DEFAULT_FORCEPOWERS        "5-1-000000000000000000"
  2.  
  3. #define MAX_CHAT_BUFFER_SIZE 65536
  4. #define MAX_CHAT_LINE_SIZE 128
  5.  
  6. #define MAX_WPARRAY_SIZE 4096
  7. #define MAX_NEIGHBOR_SIZE 32
  8.  
  9. #define MAX_NEIGHBOR_LINK_DISTANCE 128
  10. #define MAX_NEIGHBOR_FORCEJUMP_LINK_DISTANCE 400
  11.  
  12. #define TABLE_BRANCH_DISTANCE 32
  13. #define MAX_NODETABLE_SIZE 4096
  14.  
  15. #define MAX_LOVED_ONES 4
  16. #define MAX_ATTACHMENT_NAME 64
  17.  
  18. #define MAX_FORCE_INFO_SIZE 2048
  19.  
  20. #define WPFLAG_JUMP                0x00000010 //jump when we hit this
  21. #define WPFLAG_DUCK                0x00000020 //duck while moving around here
  22. #define WPFLAG_NOVIS            0x00000400 //go here for a bit even with no visibility
  23. #define WPFLAG_SNIPEORCAMPSTAND    0x00000800 //a good position to snipe or camp - stand
  24. #define WPFLAG_WAITFORFUNC        0x00001000 //wait for a func brushent under this point before moving here
  25. #define WPFLAG_SNIPEORCAMP        0x00002000 //a good position to snipe or camp - crouch
  26. #define WPFLAG_ONEWAY_FWD        0x00004000 //can only go forward on the trial from here (e.g. went over a ledge)
  27. #define WPFLAG_ONEWAY_BACK        0x00008000 //can only go backward on the trail from here
  28. #define WPFLAG_GOALPOINT        0x00010000 //make it a goal to get here.. goal points will be decided by setting "weight" values
  29. #define WPFLAG_RED_FLAG            0x00020000 //red flag
  30. #define WPFLAG_BLUE_FLAG        0x00040000 //blue flag
  31. #define WPFLAG_NOMOVEFUNC        0x00200000 //don't move over if a func is under
  32.  
  33. #define WP_KEEP_FLAG_DIST            128
  34.  
  35. #define BWEAPONRANGE_MELEE            1
  36. #define BWEAPONRANGE_MID            2
  37. #define BWEAPONRANGE_LONG            3
  38. #define BWEAPONRANGE_SABER            4
  39.  
  40. #define MELEE_ATTACK_RANGE            256
  41. #define SABER_ATTACK_RANGE            128
  42. #define MAX_CHICKENWUSS_TIME        10000 //wait 10 secs between checking which run-away path to take
  43.  
  44. #define BOT_RUN_HEALTH                40
  45. #define BOT_WPTOUCH_DISTANCE        32
  46. #define ENEMY_FORGET_MS                10000
  47. //if our enemy isn't visible within 10000ms (aprx 10sec) then "forget" about him and treat him like every other threat, but still look for
  48. //more immediate threats while main enemy is not visible
  49.  
  50. #define BOT_PLANT_DISTANCE            256 //plant if within this radius from the last spotted enemy position
  51. #define BOT_PLANT_INTERVAL            15000 //only plant once per 15 seconds at max
  52. #define BOT_PLANT_BLOW_DISTANCE        256 //blow det packs if enemy is within this radius and I am further away than the enemy
  53.  
  54. #define BOT_MAX_WEAPON_GATHER_TIME    1000 //spend a max of 1 second after spawn issuing orders to gather weapons before attacking enemy base
  55. #define BOT_MAX_WEAPON_CHASE_TIME    15000 //time to spend gathering the weapon before persuing the enemy base (in case it takes longer than expected)
  56.  
  57. #define BOT_MAX_WEAPON_CHASE_CTF    5000 //time to spend gathering the weapon before persuing the enemy base (in case it takes longer than expected) [ctf-only]
  58.  
  59. #define BOT_MIN_SAGA_GOAL_SHOOT        1024
  60. #define BOT_MIN_SAGA_GOAL_TRAVEL    128
  61.  
  62. #define BASE_GUARD_DISTANCE            256 //guarding the flag
  63. #define BASE_FLAGWAIT_DISTANCE        256 //has the enemy flag and is waiting in his own base for his flag to be returned
  64. #define BASE_GETENEMYFLAG_DISTANCE    256 //waiting around to get the enemy's flag
  65.  
  66. #define BOT_FLAG_GET_DISTANCE        256
  67.  
  68. #define MAX_PROJECTILE_DISTANCE        256
  69.  
  70. typedef enum
  71. {
  72.     CTFSTATE_NONE,
  73.     CTFSTATE_ATTACKER,
  74.     CTFSTATE_DEFENDER,
  75.     CTFSTATE_RETRIEVAL,
  76.     CTFSTATE_GUARDCARRIER,
  77.     CTFSTATE_GETFLAGHOME,
  78.     CTFSTATE_MAXCTFSTATES
  79. } bot_ctf_state_t;
  80.  
  81. typedef enum
  82. {
  83.     SAGASTATE_NONE,
  84.     SAGASTATE_ATTACKER,
  85.     SAGASTATE_DEFENDER,
  86.     SAGASTATE_MAXSAGASTATES
  87. } bot_saga_state_t;
  88.  
  89. typedef enum
  90. {
  91.     TEAMPLAYSTATE_NONE,
  92.     TEAMPLAYSTATE_FOLLOWING,
  93.     TEAMPLAYSTATE_ASSISTING,
  94.     TEAMPLAYSTATE_REGROUP,
  95.     TEAMPLAYSTATE_MAXTPSTATES
  96. } bot_teamplay_state_t;
  97.  
  98. typedef struct wpneighbor_s
  99. {
  100.     int num;
  101.     int forceJumpTo;
  102. } wpneighbor_t;
  103.  
  104. typedef struct wpobject_s
  105. {
  106.     vec3_t origin;
  107.     int inuse;
  108.     int index;
  109.     float weight;
  110.     float disttonext;
  111.     int flags;
  112.     int associated_entity;
  113.  
  114.     int forceJumpTo;
  115.  
  116.     int neighbornum;
  117.     //int neighbors[MAX_NEIGHBOR_SIZE];
  118.     wpneighbor_t neighbors[MAX_NEIGHBOR_SIZE];
  119. } wpobject_t;
  120.  
  121. typedef struct botattachment_s
  122. {
  123.     int level;
  124.     char name[MAX_ATTACHMENT_NAME];
  125. } botattachment_t;
  126.  
  127. typedef struct nodeobject_s
  128. {
  129.     vec3_t origin;
  130.     int inuse;
  131.     int index;
  132.     float weight;
  133.     int flags;
  134.     int neighbornum;
  135. } nodeobject_t;
  136.  
  137. typedef struct boteventtracker_s
  138. {
  139.     int            eventSequence;
  140.     int            events[MAX_PS_EVENTS];
  141.     float        eventTime;
  142. } boteventtracker_t;
  143.  
  144. typedef struct botskills_s
  145. {
  146.     int                    reflex;
  147.     float                accuracy;
  148.     float                turnspeed;
  149.     float                turnspeed_combat;
  150.     float                maxturn;
  151.     int                    perfectaim;
  152. } botskills_t;
  153.  
  154. //bot state
  155. typedef struct bot_state_s
  156. {
  157.     int inuse;                                        //true if this state is used by a bot client
  158.     int botthink_residual;                            //residual for the bot thinks
  159.     int client;                                        //client number of the bot
  160.     int entitynum;                                    //entity number of the bot
  161.     playerState_t cur_ps;                            //current player state
  162.     usercmd_t lastucmd;                                //usercmd from last frame
  163.     bot_settings_t settings;                        //several bot settings
  164.     float thinktime;                                //time the bot thinks this frame
  165.     vec3_t origin;                                    //origin of the bot
  166.     vec3_t velocity;                                //velocity of the bot
  167.     vec3_t eye;                                        //eye coordinates of the bot
  168.     int setupcount;                                    //true when the bot has just been setup
  169.     float ltime;                                    //local bot time
  170.     float entergame_time;                            //time the bot entered the game
  171.     int ms;                                            //move state of the bot
  172.     int gs;                                            //goal state of the bot
  173.     int ws;                                            //weapon state of the bot
  174.     vec3_t viewangles;                                //current view angles
  175.     vec3_t ideal_viewangles;                        //ideal view angles
  176.     vec3_t viewanglespeed;
  177.  
  178.     //rww - new AI values
  179.     gentity_t            *currentEnemy;
  180.     gentity_t            *revengeEnemy;
  181.  
  182.     gentity_t            *squadLeader;
  183.  
  184.     gentity_t            *lastHurt;
  185.     gentity_t            *lastAttacked;
  186.  
  187.     gentity_t            *wantFlag;
  188.  
  189.     gentity_t            *touchGoal;
  190.     gentity_t            *shootGoal;
  191.  
  192.     gentity_t            *dangerousObject;
  193.  
  194.     vec3_t                staticFlagSpot;
  195.  
  196.     int                    revengeHateLevel;
  197.     int                    isSquadLeader;
  198.  
  199.     int                    squadRegroupInterval;
  200.     int                    squadCannotLead;
  201.  
  202.     int                    lastDeadTime;
  203.  
  204.     wpobject_t            *wpCurrent;
  205.     wpobject_t            *wpDestination;
  206.     wpobject_t            *wpStoreDest;
  207.     vec3_t                goalAngles;
  208.     vec3_t                goalMovedir;
  209.     vec3_t                goalPosition;
  210.  
  211.     vec3_t                lastEnemySpotted;
  212.     vec3_t                hereWhenSpotted;
  213.     int                    lastVisibleEnemyIndex;
  214.     int                    hitSpotted;
  215.  
  216.     int                    wpDirection;
  217.  
  218.     float                destinationGrabTime;
  219.     float                wpSeenTime;
  220.     float                wpTravelTime;
  221.     float                wpDestSwitchTime;
  222.     float                wpSwitchTime;
  223.     float                wpDestIgnoreTime;
  224.  
  225.     float                timeToReact;
  226.  
  227.     float                enemySeenTime;
  228.  
  229.     float                chickenWussCalculationTime;
  230.  
  231.     float                beStill;
  232.     float                duckTime;
  233.     float                jumpTime;
  234.     float                jDelay;
  235.  
  236.     float                aimOffsetTime;
  237.     float                aimOffsetAmtYaw;
  238.     float                aimOffsetAmtPitch;
  239.  
  240.     float                frame_Waypoint_Len;
  241.     int                    frame_Waypoint_Vis;
  242.     float                frame_Enemy_Len;
  243.     int                    frame_Enemy_Vis;
  244.  
  245.     int                    isCamper;
  246.     float                isCamping;
  247.     wpobject_t            *wpCamping;
  248.     wpobject_t            *wpCampingTo;
  249.     qboolean            campStanding;
  250.  
  251.     int                    randomNavTime;
  252.     int                    randomNav;
  253.  
  254.     int                    meleeSpecialist;
  255.  
  256.     int                    canChat;
  257.     int                    chatFrequency;
  258.     char                currentChat[MAX_CHAT_LINE_SIZE];
  259.     float                chatTime;
  260.     float                chatTime_stored;
  261.     int                    doChat;
  262.     int                    chatTeam;
  263.     gentity_t            *chatObject;
  264.     gentity_t            *chatAltObject;
  265.  
  266.     float                meleeStrafeTime;
  267.     int                    meleeStrafeDir;
  268.     float                meleeStrafeDisable;
  269.  
  270.     int                    altChargeTime;
  271.  
  272.     float                escapeDirTime;
  273.  
  274.     float                dontGoBack;
  275.  
  276.     int                    doAttack;
  277.     int                    doAltAttack;
  278.  
  279.     int                    forceWeaponSelect;
  280.     int                    virtualWeapon;
  281.  
  282.     int                    runningLikeASissy;
  283.     int                    runningToEscapeThreat;
  284.  
  285.     //char                chatBuffer[MAX_CHAT_BUFFER_SIZE];
  286.     //Since we're once again not allocating bot structs dynamically,
  287.     //shoving a 64k chat buffer into one is a bad thing.
  288.  
  289.     botskills_t            skills;
  290.  
  291.     botattachment_t        loved[MAX_LOVED_ONES];
  292.     int                    lovednum;
  293.  
  294.     int                    loved_death_thresh;
  295.  
  296.     int                    deathActivitiesDone;
  297.  
  298.     float                botWeaponWeights[WP_NUM_WEAPONS];
  299.  
  300.     int                    ctfState;
  301.  
  302.     int                    teamplayState;
  303.  
  304.     int                    state_Forced; //set by player ordering menu
  305.  
  306.     int                    noUseTime;
  307.  
  308.     vec3_t                launchAngle;
  309.     //end rww
  310. } bot_state_t;
  311.  
  312. void *B_TempAlloc(int size);
  313. void B_TempFree(int size);
  314.  
  315. void *B_Alloc(int size);
  316. void B_Free(void *ptr);
  317.  
  318. //resets the whole bot state
  319. void BotResetState(bot_state_t *bs);
  320. //returns the number of bots in the game
  321. int NumBots(void);
  322.  
  323. void BotUtilizePersonality(bot_state_t *bs);
  324. int BotDoChat(bot_state_t *bs, char *section, int always);
  325. void StandardBotAI(bot_state_t *bs, float thinktime);
  326. void BotWaypointRender(void);
  327. int OrgVisibleBox(vec3_t org1, vec3_t mins, vec3_t maxs, vec3_t org2, int ignore);
  328. int BotIsAChickenWuss(bot_state_t *bs);
  329. int GetNearestVisibleWP(vec3_t org, int ignore);
  330. int GetBestIdleGoal(bot_state_t *bs);
  331.  
  332. char *ConcatArgs( int start );
  333.  
  334. extern vmCvar_t bot_attachments;
  335. extern vmCvar_t bot_camp;
  336.  
  337. extern vmCvar_t bot_wp_info;
  338. extern vmCvar_t bot_wp_edit;
  339. extern vmCvar_t bot_wp_clearweight;
  340. extern vmCvar_t bot_wp_distconnect;
  341. extern vmCvar_t bot_wp_visconnect;
  342.  
  343. extern wpobject_t *flagRed;
  344. extern wpobject_t *oFlagRed;
  345. extern wpobject_t *flagBlue;
  346. extern wpobject_t *oFlagBlue;
  347.  
  348. extern gentity_t *eFlagRed;
  349. extern gentity_t *eFlagBlue;
  350.  
  351. extern char gBotChatBuffer[MAX_CLIENTS][MAX_CHAT_BUFFER_SIZE];
  352. extern float gWPRenderTime;
  353. extern float gDeactivated;
  354. extern float gBotEdit;
  355. extern int gWPRenderedFrame;
  356. extern wpobject_t *gWPArray[MAX_WPARRAY_SIZE];
  357. extern int gWPNum;
  358. extern int gLastPrintedIndex;
  359. extern nodeobject_t nodetable[MAX_NODETABLE_SIZE];
  360. extern int nodenum;
  361.  
  362. extern float floattime;
  363. #define FloatTime() floattime
  364.